package com.jixiantubu.yueban;

import image.SmartImageView;

import java.util.ArrayList;
import java.util.List;
import com.example.jixiantubu.R;
import com.jixiantubu.bean.Ac_Bean;
import com.jixiantubu.util.MyApplication;

import android.R.integer;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class YueBan_XiangQing extends Activity implements OnClickListener {
	private RelativeLayout ac_number_rv;
	private Button ac_baoming_xq;
	private ImageView ac_xq_back;
	private Context context;
	private Ac_Bean ac;
	private SmartImageView ac_pic_path;
	private TextView ac_number, ac_number_sum, ac_title, ac_venue, ac_user_nikename,
			ac_time, ac_content;
	private List<Ac_Bean> list = new ArrayList<Ac_Bean>();
	private String url = "http://" + MyApplication.getIP()
			+ ":8080/Jinnang/YueBan_Middle";

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		Window window = this.getWindow();
		window.requestFeature(window.FEATURE_NO_TITLE);
		setContentView(R.layout.ac_xiangqing);
		initViews();
		initData();

	}

	private void initViews() {
		Intent intent = getIntent();
		ac = (Ac_Bean) intent.getSerializableExtra("ac");
		ac_xq_back = (ImageView) findViewById(R.id.ac_xq_back);
		ac_number_rv = (RelativeLayout) findViewById(R.id.ac_number_rv);
		ac_baoming_xq = (Button) findViewById(R.id.ac_baoming_xq);
		ac_pic_path = (SmartImageView) findViewById(R.id.tupian_xq);
		ac_title = (TextView) findViewById(R.id.ac_title_xq);
		ac_number_sum = (TextView) findViewById(R.id.ac_number_xq);
		ac_number = (TextView) findViewById(R.id.ac_number_max);
		ac_user_nikename = (TextView) findViewById(R.id.user_nikename_xq);
		ac_venue = (TextView) findViewById(R.id.ac_venue_xq);
		ac_time = (TextView) findViewById(R.id.ac_time_xq);
		ac_content = (TextView) findViewById(R.id.ac_neirong);
		ac_xq_back.setOnClickListener(this);
		ac_number_rv.setOnClickListener(this);
		ac_baoming_xq.setOnClickListener(this);

	}

	private void initData() {
		String resId = "http://" + MyApplication.getIP() + ":8080/Jinnang/img/"
				+ ac.getAc_pic_path();
		ac_pic_path.setImageUrl(resId);
	//	System.out.println("具体图片"+resId);
		ac_title.setText(ac.getAc_title());
		ac_number.setText(String.valueOf(ac.getAc_number_sum()) + "/"
				+ String.valueOf(ac.getAc_number()));
		ac_user_nikename.setText("组织者：" + ac.getUser_nickname());
		ac_venue.setText("集合地：" + ac.getAc_venue());
		ac_time.setText("时间：" + ac.getAc_time() + "——" + ac.getAc_lastTime());
		ac_content.setText(ac.getAc_content());

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.ac_xq_back:
			finish();
			break;
		case R.id.ac_number_rv:
			Intent i1 = new Intent(YueBan_XiangQing.this,
					YueBan_YiBaoMing.class);
			startActivity(i1);
			break;
		case R.id.ac_baoming_xq:
			Intent i2 = new Intent(YueBan_XiangQing.this,
					YueBan_XQ_BaoMing.class);
			i2.putExtra("ac", ac);
			startActivity(i2);
			break;
		default:
			break;
		}

	}
}
